<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>答题页面</title>

    <link rel="stylesheet" href="../../static/layui-main/dist/css/layui.css">
    <script src="../../static/layui-main/src/layui.js"></script>
    <style>

        .top-div {
            padding-top: 100px;
            background-color: rgba(234, 245, 255, 0.96);
        }

        .top-div-d {
            width: 85%;
            padding: 30px 30px 0px 30px;
            margin: 0 auto;
            text-align: center;
            background-color: rgba(255, 255, 255, .7);
        }

        .top-div-h {
            padding: 5px;
            font-weight: bolder
        }

        .top-div-p {
            margin: 5px 0px 0px 0px;
            color: #a9a9aa;
        }

        .mid-div {
            padding: 40px;
            background-color: white;
            /*text-align: center;*/
            margin: 0 auto;
        }

        .mid-list {
            width: 50%;
            padding: 20px;
            border-radius: 8px;
            box-shadow: #cacaca 0px 0px 10px;
            margin: 0 auto;
        }

        .mid-question {
            margin-top: 10px;
            display: none;
        }

        .mid-topic {
            margin: 8px 0;
            color: #41464b;
            font-size: 17px;
        }

        .mid-option {
            margin: 10px 0;
            padding: 5px;
            border-radius: 8px;
            text-align: left;
            color: #41464b;
            background-color: #e2ecf6;
        }

        .bottom-div{
            margin: 0 auto;
            width: 50%;
            padding-top: 10px;
            text-align: center;
        }
        .bottom-btn-left{
            float: left;
        }
        .bottom-btn-right{
            float: right;
        }
        .bottom-submit{
            display: none;
        }

        #id_1 {
            display: block;
        }

        @media screen and (max-device-width: 1000px) {
            .top-div {
                padding-top: 50px;
            }

            .mid-list {
                width: 90%;
            }
            .mid-div {
                padding: 20px;
                /*background-color: white;*/
                /*text-align: center;*/
            }
            .bottom-div{
                width: 90%;
            }
        }

    </style>

</head>
<body>
<!--性格色彩框，边距40，透明白色-->
<div class="top-div">
    <div class="top-div-d">
        <h1 class="top-div-h">SDS抑郁测试</h1>
        <p class="top-div-p">完成测试，获得专业的分析报告</p>
    </div>
</div>
<!--问题大div,上下padding-->
<div class="mid-div">
    <!--  进度条加问题选项  -->
    <div class="mid-list">
        <!--    进度条    -->
        <div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="demo">
            <div class="layui-progress-bar layui-bg-blue" lay-percent="1%"></div>
        </div>
        <!--  问题  -->
        <input id="testerId" type="hidden" value="472">
        <input id="questionsLen" type="hidden" value="30">
        <div>
            <div class="mid-question" id="id_1">
                <label class="mid-topic">1、我觉得闷闷不乐，情绪低沉</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_1" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_1" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_1" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_1" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_2">
                <label class="mid-topic">2、我觉得一天之中早晨最好</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_2" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_2" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_2" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_2" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_3">
                <label class="mid-topic">3、我一阵阵地哭出来或是想哭</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_3" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_3" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_3" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_3" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_4">
                <label class="mid-topic">4、我晚上睡眠不好</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_4" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_4" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_4" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_4" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_5">
                <label class="mid-topic">5、吃得跟平常一样多</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_5" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_5" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_5" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_5" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_6">
                <label class="mid-topic">6、我与异性接触时和以往样感到愉快</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_6" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_6" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_6" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_6" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_7">
                <label class="mid-topic">7、我发觉我的体重在下降</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_7" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_7" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_7" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_7" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_8">
                <label class="mid-topic">8、我有便秘的苦恼</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_8" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_8" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_8" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_8" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_9">
                <label class="mid-topic">9、我心跳比平时快</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_9" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_9" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_9" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_9" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_10">
                <label class="mid-topic">10、我无缘无故感到疲乏</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_10" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_10" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_10" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_10" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_11">
                <label class="mid-topic">11、我的头脑和平时一样清楚</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-form-item">
                            <div class="layui-input-block mid-option">
                                <input type="radio" lay-filter="qso"
                                       id="A_11" name="1"
                                       value="A" title="A没有或很少有。">
                            </div>
                            <div class="layui-input-block mid-option">
                                <input type="radio" lay-filter="qso"
                                       id="B_11" name="1"
                                       value="B" title="B有时候有。">
                            </div>
                            <div class="layui-input-block mid-option">
                                <input type="radio" lay-filter="qso"
                                       id="C_11" name="1"
                                       value="C" title="C大部分时间有。">
                            </div>
                            <div class="layui-input-block mid-option">
                                <input type="radio" lay-filter="qso"
                                       id="D_11" name="1"
                                       value="D" title="D绝大部分时间有。">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_12">
                <label class="mid-topic">12、我觉得经常做的事情并没有困难</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-form-item">
                            <div class="layui-input-block mid-option">
                                <input type="radio" lay-filter="qso"
                                       id="A_12" name="1"
                                       value="A" title="A没有或很少有。">
                            </div>
                            <div class="layui-input-block mid-option">
                                <input type="radio" lay-filter="qso"
                                       id="B_12" name="1"
                                       value="B" title="B有时候有。">
                            </div>
                            <div class="layui-input-block mid-option">
                                <input type="radio" lay-filter="qso"
                                       id="C_12" name="1"
                                       value="C" title="C大部分时间有。">
                            </div>
                            <div class="layui-input-block mid-option">
                                <input type="radio" lay-filter="qso"
                                       id="D_12" name="1"
                                       value="D" title="D绝大部分时间有。">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_13">
                <label class="mid-topic">13、我坐立不安，难以保持平静</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_13" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_13" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_13" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_13" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_14">
                <label class="mid-topic">14、我对将来抱有希望</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_14" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_14" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_14" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_14" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_15">
                <label class="mid-topic">15、我比平常容易生气激动</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_15" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_15" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_15" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_15" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_16">
                <label class="mid-topic">16、我觉得做出决定是容易的</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_16" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_16" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_16" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_16" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_17">
                <label class="mid-topic">17、我觉得自己是个有用的人</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_17" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_17" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_17" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_17" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_18">
                <label class="mid-topic">18、我的生活过得很有意思</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_18" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_18" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_18" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_18" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_19">
                <label class="mid-topic">19、我认为如果我死了别人会生活得好些</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_19" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_19" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_19" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_19" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div>
            <div class="mid-question" id="id_20">
                <label class="mid-topic">20、,平常感兴趣的事我仍然照样感兴趣</label>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="A_20" name="1"
                                   value="A" title="A没有或很少有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="B_20" name="1"
                                   value="B" title="B有时候有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="C_20" name="1"
                                   value="C" title="C大部分时间有。">
                        </div>
                        <div class="layui-input-block mid-option">
                            <input type="radio" lay-filter="qso"
                                   id="D_20" name="1"
                                   value="D" title="D绝大部分时间有。">
                        </div>
                    </div>
                </form>
            </div>
        </div>


        <div class="bottom-div">
            <button id="pre_btn" type="button" class="layui-btn  layui-bg-blue bottom-btn-left">
                <i class="layui-icon layui-icon-left"></i>
            </button>
            <button id="submit_btn"  type="submit" class="layui-btn  layui-btn-warm layui-btn-radius bottom-submit">提交</button>
            <button id="next_btn"  type="button" class="layui-btn  layui-bg-blue bottom-btn-right">
                <i class="layui-icon layui-icon-right"></i>
            </button>
        </div>
    </div>
    </div>
</div>

<script>
    var type=null;
    layui.use(['layer', 'element', 'form', 'jquery'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            element = layui.element,
            form = layui.form;

        var resultList = [];
        var questionsLen = $("#questionsLen").val();
        var index=0;

        form.on('radio(qso)', function (data) {
            //定义一个result对象
            var result = new Object();
            //获取测试者id
            result.testerId=$("#testerId").val();
            //获取测试题id
            result.questionId=data.elem.name;
            //获取答案
            result.answer=data.value;
            //获取题目编号（1-20）
            index=parseInt(data.elem.id.split("_")[1]);
            //添加答案到resultList
            if (index<=resultList.length){
                resultList[index-1] = result;
            }else {
                resultList.push(result);
            }
            if(resultList.length==questionsLen){
                $('#submit_btn').show();
            }else {
                if (index!=questionsLen){
                    //隐藏当前的题目
                    $('#id_'+index).hide();
                    //显示下一题目
                    $('#id_'+(index+1)).show();
                }
            }
            //计算进度条
            element.progress('demo', Math.ceil(index/20*100)+'%');
        });

        $('#pre_btn').on('click',function () {
            if (resultList.length!=questionsLen){//没做完时
                if (index>0){
                    $('#id_'+(index+1)).hide();
                    $('#id_'+index).show();
                    index--;
                }
            }else {//做完时
                if (index>1){
                    $('#id_'+index).hide();
                    $('#id_'+(index-1)).show();
                    index--;
                }
            }

        });
        $('#next_btn').on('click',function () {
            if (resultList.length!=questionsLen){//没做完时
                if (index<resultList.length){
                    index++;
                    $('#id_'+index).hide();
                    $('#id_'+(index+1)).show();
                }
            }else {//做完时
                if (index<questionsLen){
                    $('#id_'+index).hide();
                    $('#id_'+(index+1)).show();
                    index++;
                }
            }
        });
        $('#submit_btn').on('click',function () {
            var resultListJson = JSON.stringify(resultList);
            if(resultList.length==questionsLen){
                //发送ajax请求到后端
                $.ajax({
                    url:"/testResult/saveBatchTestResult",
                    type: "POST",
                    dataType:"JSON",
                    contentType:"application/json;charset=UTF-8",
                    data:resultListJson,
                    success:function (ret) {
                        if(ret.code==0){
                            if(type==1){
                                window.location.href="/test/toSuccess";
                            }else {
                                window.location.href="/test/toResult?id="+$("#testerId").val();
                            }

                        }else
                        {
                            layer.msg(ret.msg,{icon: 5});
                        }

                    }
                })
            }else {
                alert("请做完后在提交");
            }
        });

    });
</script>

</body>
</html>
